<template>
  <div id="app">
    <work-form @submit="handleSubmit"></work-form>
  </div>
</template>

<script>
import { insert } from "./services";
import { MessageBox } from "element-ui";
import WorkForm from "@isyscore/studio-page-a3397d1d2fd203c9ad305197a4149210-v3";
export default {
  name: "App",
  components: { WorkForm },
  data() {
    return {
      visible: false,
    };
  },
  methods: {
    handleAction(event) {
      console.log(event);
      const { type } = event;
      if (type === "add") {
        this.visible = true;
      }
    },

    async handleSubmit(params) {
      const { appCode, fieldIdRecordList, formId, recordData } = params;
      const res = await insert({
        appCode,
        fieldIdRecordList,
        formId,
        recordData,
      });
      //成功
      if (res) {
        this.visible = false;
        MessageBox({
          title: '提示',
          type: "success",
          message: "提交成功!",
        });
      }
    },
  },
};
</script>

<style>
#app {
  height: 100vh;
  display: flex;
  padding: 30px;
}
</style>
